
 var a=localStorage.getItem("userNum")
 /*
          渲染列表
        */
       
       var vm = new Vue({
        el: '#app',

        data: {

            list: [],

        },
        beforeCreate: function () {
            var _this = this
            $.ajax({
                type: "post",//请求方式
                url: "http://39.108.233.68:8002/student/selOneSelectCourseByStuId",
                data: { id: a },
                success: function (data) {
                    //_this.list = data.data
                    for (var i = 0; i < data.data.length; i++) {
                        if (data.data[i].course != null) {
                            _this.list.push(data.data[i])
                        }
                    }
                 
                    console.log(_this.list)
                },
                error: function () {
                    alert("error");
                }
            })

        },

        methods: {
            toDel: function (id) {
                //alert(id)
                console.log(id)
                
                $.ajax({
                    type: 'post',
                    url: 'http://39.108.233.68:8002/student/delOneSelectCourse',
                    data: {
                        id: id,

                    },
                    success: function (data) {
                        //console.log(data)

                        window.location.reload();
                        alert("退课成功！");
                    },
                    error: function (data) {
                        window.location.reload();
                        alert("退课失败！");

                    }
                });

            }
        },

        updated: function () {
            $('#dataList').DataTable({

                language: {
                    "sProcessing": "处理中...",
                    "sLengthMenu": "显示 _MENU_ 项结果",
                    "sZeroRecords": "没有匹配结果",
                    "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                    "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                    "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                    "sInfoPostFix": "",
                    "sSearch": "搜索:",
                    "sUrl": "",
                    "sEmptyTable": "表中数据为空",
                    "sLoadingRecords": "载入中...",
                    "sInfoThousands": ",",
                    "oPaginate": {
                        "sFirst": "首页",
                        "sPrevious": "上页",
                        "sNext": "下页",
                        "sLast": "末页"
                    },

                },

                "paging": true,
                "lengthChange": false,
                "searching": false,
                "ordering": false,
                "info": true,
                "autoWidth": false
            });

        },

    });